<template>
  <div>
    <x-header id="header" :left-options="{backText: ''}">团队客户</x-header>
    <div class="main-header">
      <scroller
        :scroll-bottom-offset="50"
        lock-x
        :use-pullup="true"
        :pullupConfig="{downContent:'↑',upContent:'',loadingContent:'请稍后',content:''}"
        @on-pullup-loading="getList"
        v-model="status">
        <div class="box1">
          <div>
            <x-table :cell-bordered="false" style="background-color:#fff;">
              <thead>
              <tr>
                <th>客户姓名</th>
                <th>放款金额</th>
                <th>放款时间</th>
              </tr>
              </thead>
              <tbody>
              <tr v-for="(item, index) in list" :key="index">
                <td>{{item.name}}</td>
                <td>{{item.loanAmount}}</td>
                <td >{{item.createTime}}</td>
              </tr>
              </tbody>
            </x-table>
          </div>
        </div>
      </scroller>
    </div>
  </div>
</template>

<script>
import { getUserLoan }  from '@/api/user'
export default {
  name: 'team',
  data () {
    return {
      status: {
        pullupStatus:'',
      },
      cp: 1,
      lp: 1,
      list: []
    }
  },
  methods: {
    getList() {
      if (this.cp >= this.lp) {
        this.$vux.toast.text('暂无更多信息')
        setTimeout(() => {
          this.$set(this.status,'pullupStatus', 'default')
        }, 200)

      } else {
        getUserLoan(this.cp + 1).then(data => {
          this.list = data.data
          this.cp = data.current_page
          this.lp = data.last_page
        })
        setTimeout(() => {
          this.$set(this.status,'pullupStatus', 'default')
        }, 500)
      }
    }
  },
  mounted () {
    getUserLoan({cid:this.$route.query.id}).then(data => {
      this.list = data.data
      this.cp = data.current_page
      this.lp = data.last_page
    })
  }
}
</script>

<style scoped>

</style>
